<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2017/5/31
 * Time: 16:31
 */

namespace Weixin\Component\Weixin;


use Common\Common\Component;
use Weixin\Model\Weixin\WeixinModel;

class WeixinComponent extends Component
{
    private $model;

    public function __construct()
    {
        $this->model = new WeixinModel();
    }

    public function addWeixin($openid, $nickname, $headimgurl, $subscribe)
    {
        return $this->model->addWeixin($openid, $nickname, $headimgurl, $subscribe);
    }

    public function findWeixin($openid)
    {
        return $this->model->findWeixin($openid);
    }

    public function changeSubscribe($openid, $subscribe)
    {
        return $this->model->changeSubscribe($openid, $subscribe);
    }

    public function setCookie($openid)
    {
        cookie('openid', $openid, 10);
    }

    public function getCookie()
    {
        return cookie('openid');
    }
}